---
title: Retrieve policy associations
summary: Builds the policy-to-policy association list, combining manual affiliation, policy relationship, discount combination, and experience combination sources.
status: draft
owner: SAIF Corporation
last_reviewed: 2026-09-01
library: SAIF.Business.View.Policy
reference_type: embedded
operation_id: op-04-retrieve-policy-associations
trigger: Consumer reads Associations
---

# Retrieve policy associations

Builds the full list of policies associated with a given policy — manual affiliations, policy-relationship links, discount combinations, and experience-rating combinations — and separately supports a data-driven, per-association-type lookup path used for grouped/typed associations.

| Field | Value |
| --- | --- |
| **Operation ID** | op-04-retrieve-policy-associations |
| **Trigger** | Consumer reads `Associations` (backed by `PolicyAssociationList.GetPolicyAssociationList`), or calls the typed `clsPolicyHeaderAssociationFactory.GetPolicyHeaderAssociations` |
| **Inputs** | Policy number, optional `IncludeSourcePolicy` flag, optional as-of date |
| **Outputs** | `IEnumerable(Of PolicyAssociation)` / `IEnumerable(Of IPolicyHeaderAssociation)` |
| **Primary components** | `PolicyAssociationList.GetPolicyAssociationList`, `clsPolicyHeaderAssociationFactory`, `clsAssociationTypeFactory`, `clsAssociationTypeCode.GetNonTypedAssociations` |
| **Entry point** | `SAIF.Business.View.Policy/PolicyAssociations.vb` |

## Steps

1. Caller invokes `PolicyAssociationList.GetPolicyAssociationList(inDPI, inPolicyNumber[, IncludeSourcePolicy, inAsOfDate])`.
2. If `inAsOfDate` is not supplied (`Date.MinValue`), the method binds `ecDate` to `inDPI.DataSourceDate` and `cppDate` to `GetMaxPolicyEffectiveDate(inDPI, inPolicyNumber)` — a separate scalar query against `policy_period` for `max(policy_period_eff_date)` ([SQL-035](../sql/SQL-035-max-policy-effective-date.md)). If an as-of date is supplied, both parameters use that date instead ([BR-VP-024](../business-rules.md#br-vp-024-default-association-dates)).
3. The method executes the constant `RetrieveSQL` — a four-way `UNION` of `ManualAffiliationSQL`, `PolicyRelationshipSQL`, `DiscountCombinationSQL`, and `ERCombinationSQL` ([SQL-034](../sql/SQL-034-policy-association-list.md)) — as `CommandType.Text`/`RequestType.ResultSet`, binding `ecDate`, `cppDate`, and `PolicyNumber`.
4. Each result row is converted to a `PolicyAssociation` via `ConvertAssociationType`, which maps raw relationship-type strings (`"WRAP"`, `"OREGN"`, `"LEASE"`, `"SUBAC"`, the `"M."`-prefixed manual variants, `"DiscountCombination"`, `"ExperienceCombination"`) to the `AssociationTypes` enum, defaulting to `NotSpecified` for anything unrecognized.
5. By default (`IncludeSourcePolicy = False`), the source policy itself is filtered out of the returned list ([BR-VP-014](../business-rules.md#br-vp-014-source-policy-excluded-from-associations-by-default)); `PeriodDateSQL`-based lookups ([SQL-003](../sql/SQL-003-period-date-query.md)) supply supporting period dates used elsewhere in association classification.*
6. Separately, `clsPolicyHeaderAssociationFactory.GetPolicyHeaderAssociations(inDPI, inPolicyNumber[, inTargetAssociationTypes])` retrieves the full set of configured association types via `clsAssociationTypeFactory.GetAssociationTypes` ([SQL-005](../sql/SQL-005-association-type-code-lookup.md), table `ASSOCIATION_TYPE_CODE`), partitions them into groupable (non-`None` `AssociationCategory`) and non-groupable sets, and unions the results of `GetPolicyHeaderAssociations` called on each partition.
7. For each association type, `clsAssociationTypeCode.GetNonTypedAssociations` executes a **data-driven** stored procedure whose name comes from `ASSOCIATION_TYPE_CODE.SOURCE_PROCEDURE_NAME` ([SQL-004](../sql/SQL-004-non-typed-association-lookup.md)) — the procedure to call is not known until the association-type row is read from the database ([BR-VP-021](../business-rules.md#br-vp-021-association-category-prefix-classification)).
8. `PreferredAssociationType`, when set on the consuming `clsPolicyData`/`clsAffiliatedPolicyCollection`, overrides the type otherwise derived from the association source ([BR-VP-015](../business-rules.md#br-vp-015-preferred-association-type-overrides-derived-type)); association types flagged as secured are gated by security-group membership ([BR-VP-020](../business-rules.md#br-vp-020-association-type-is-secured-when-security-group-set)).

## Process flow

```mermaid
flowchart TD
	Start(["Consumer reads<br>Associations"]) --> A["Resolve ecDate/cppDate<br>(as-of date or defaults)"]
	A --> B["Execute 4-way UNION query<br>(manual/relationship/discount/ER)"]
	B --> C["ConvertAssociationType maps<br>raw strings to AssociationTypes"]
	C --> D{IncludeSourcePolicy?}
	D -->|No| E["Filter out source policy"]
	D -->|Yes| F["Keep source policy"]
	E --> End(["Return PolicyAssociation list"])
	F --> End
	Start2(["Caller invokes<br>GetPolicyHeaderAssociations"]) --> G["Load configured<br>ASSOCIATION_TYPE_CODE rows"]
	G --> H["Partition groupable /<br>non-groupable types"]
	H --> I["Per type: execute data-driven<br>SOURCE_PROCEDURE_NAME"]
	I --> End2(["Return IPolicyHeaderAssociation list"])
```

## Failure and edge-case behavior
- `ConvertAssociationType` silently returns `NotSpecified` for any unrecognized relationship-type string rather than raising — a schema/data change upstream would surface as silently-miscategorized associations, not an error.*
- Because `SOURCE_PROCEDURE_NAME` is read from data, a missing or invalid procedure name for a given association type is not detectable by inspecting this library's source; it fails only at execution time.**
- `GetMaxPolicyEffectiveDate` returns the CLR default (`Date.MinValue`) if the policy has no periods, which is then used unchanged as `cppDate` in the union query.*

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.md)

## Sources
- `SAIF.Business.View.Policy/PolicyAssociations.vb`
- `SAIF.Business.View.Policy/Associations/clsPolicyAssociationFactory.vb`
- `SAIF.Business.View.Policy/Associations/clsAssociationTypeCode.vb`
